from google.appengine.ext import db
from google.appengine.api import users

# Create your models here.
class Draw(db.Model):

    creation_date = db.DateTimeProperty(auto_now_add=True)
    subject = db.StringProperty(multiline=False, required=True)
    body = db.TextProperty(required=True)
    language = db.StringProperty(multiline=False, required=False)
    code = db.StringProperty(multiline=False, required=False)
    
    matrix_size = db.IntegerProperty()
    mode = db.StringProperty(multiline=False)
    density = db.FloatProperty()
    loop_size = db.IntegerProperty()
    loops = db.IntegerProperty()
    success = db.BooleanProperty()
    
class Player(db.Model):
    
    name = db.StringProperty(multiline=False, required=True)
    friend = db.SelfReferenceProperty(required=False)
    draw = db.ReferenceProperty(Draw, required=False)
    
    email = db.EmailProperty(required=True)
    domain = db.StringProperty(multiline=False, required=True)
    
    pwd = db.StringProperty(multiline=False, required=True)
    wish = db.TextProperty(required=False)
    dont_wish = db.TextProperty(required=False)
    got = db.TextProperty(required=False)
    
    def __unicode__(self):
        return '%s ' % self.name
